package cn.tedu.test.luban.demo.condition.config;

import cn.tedu.test.luban.demo.bean.Bean04;
import cn.tedu.test.luban.demo.condition.OnOtherOSCondition;
import cn.tedu.test.luban.demo.condition.OnWindowsCondition;
import cn.tedu.test.luban.demo.condition.annotation.ConditionalOnWindows;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;

@Configuration
// @ConditionalOnWindows
//@Conditional(OnOtherOSCondition.class)

@ConditionalOnProperty(
        prefix = "luban",
        value = "user.name",
        havingValue = "Jerry",
        matchIfMissing = false
)
public class MyConditionConfig01 {

    public MyConditionConfig01(){
        System.out.println("条件配置config01被容器加载");
    }

    @Bean
    // @Conditional(OnOtherOSCondition.class)
    @ConditionalOnWindows
    public Bean04 bean04(){
        return new Bean04();
    }

}
